package com.xiaoxi.exam.dao;

import com.xiaoxi.exam.model.ExamToefl;
import com.xiaoxi.exam.model.ExamToeflExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ExamToeflMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    long countByExample(ExamToeflExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    int deleteByExample(ExamToeflExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    @Update({
        "update s_exam.t_exam_toefl",
        "set deleted_at = now()",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    @Select({
        "insert into s_exam.t_exam_toefl (city, cost, ",
        "status, exam_code, ",
        "exam_time, exam_name, ",
        "exam_month, created_at, ",
        "updated_at, deleted_at)",
        "values (#{city,jdbcType=VARCHAR}, #{cost,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=VARCHAR}, #{examCode,jdbcType=VARCHAR}, ",
        "#{examTime,jdbcType=VARCHAR}, #{examName,jdbcType=VARCHAR}, ",
        "#{examMonth,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, ",
        "#{updatedAt,jdbcType=TIMESTAMP}, #{deletedAt,jdbcType=TIMESTAMP})", 
        " returning id"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    long insertReturningId(ExamToefl record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    @Insert({
        "insert into s_exam.t_exam_toefl (city, cost, ",
        "status, exam_code, ",
        "exam_time, exam_name, ",
        "exam_month, created_at, ",
        "updated_at, deleted_at)",
        "values (#{city,jdbcType=VARCHAR}, #{cost,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=VARCHAR}, #{examCode,jdbcType=VARCHAR}, ",
        "#{examTime,jdbcType=VARCHAR}, #{examName,jdbcType=VARCHAR}, ",
        "#{examMonth,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, ",
        "#{updatedAt,jdbcType=TIMESTAMP}, #{deletedAt,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(ExamToefl record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    long insertSelectiveReturningId(ExamToefl record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    int insertSelective(ExamToefl record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    List<ExamToefl> selectByExample(ExamToeflExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    @Select({
        "select",
        "id, city, cost, status, exam_code, exam_time, exam_name, exam_month, created_at, ",
        "updated_at, deleted_at",
        "from s_exam.t_exam_toefl",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("com.xiaoxi.exam.dao.ExamToeflMapper.BaseResultMap")
    ExamToefl selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    int updateByExampleSelective(@Param("record") ExamToefl record, @Param("example") ExamToeflExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    int updateByExample(@Param("record") ExamToefl record, @Param("example") ExamToeflExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    int updateByPrimaryKeySelective(ExamToefl record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table s_exam.t_exam_toefl
     *
     * @mbg.generated Wed Nov 28 22:48:31 CST 2018
     */
    @Update({
        "update s_exam.t_exam_toefl",
        "set city = #{city,jdbcType=VARCHAR},",
          "cost = #{cost,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=VARCHAR},",
          "exam_code = #{examCode,jdbcType=VARCHAR},",
          "exam_time = #{examTime,jdbcType=VARCHAR},",
          "exam_name = #{examName,jdbcType=VARCHAR},",
          "exam_month = #{examMonth,jdbcType=VARCHAR},",
          "created_at = #{createdAt,jdbcType=TIMESTAMP},",
          "updated_at = #{updatedAt,jdbcType=TIMESTAMP},",
          "deleted_at = #{deletedAt,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ExamToefl record);
}